package com.derbysoft.dswitch.adapter.ihg.web.action.admin.setting.channel;

import com.derbysoft.dswitch.adapter.ihg.common.domain.ChannelAuthorization;
import com.derbysoft.dswitch.adapter.ihg.common.repository.ChannelAuthorizationRepository;
import com.derbysoft.dswitch.adapter.ihg.web.action.support.PaginateActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


public class ListAction extends PaginateActionSupport {

    @Autowired
    private ChannelAuthorizationRepository channelAuthorizationRepository;

    private List<ChannelAuthorization> channelAuthorizations;

    private List<ChannelAuthorization> newChannelAuthorizations;

    @Action("list")
    public String list() {
        channelAuthorizations = channelAuthorizationRepository.loadAll();
        return SUCCESS;
    }

    public List<ChannelAuthorization> getChannelAuthorizations() {
        return channelAuthorizations;
    }

    public List<ChannelAuthorization> getNewChannelAuthorizations() {
        return newChannelAuthorizations;
    }

    public void setNewChannelAuthorizations(List<ChannelAuthorization> newChannelAuthorizations) {
        this.newChannelAuthorizations = newChannelAuthorizations;
    }
}
